package com.lovo.common.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 死信队列配置
 */
@Configuration
@EnableRabbit
public class DeadLetterConfiguation {
    @Bean
    public DirectExchange deadExchange(){
        return new DirectExchange("dead.exchange");
    }
    @Bean
    public Queue registerDeadQueue(){
        return new Queue("register.dead.queue");
    }
    @Bean
    public Binding registerDeadBinding(){
        return BindingBuilder.bind(registerDeadQueue()).to(deadExchange()).with("rk.dead");
    }
}
